home *** CD-ROM | disk | FTP | other *** search
- global gLinkList, gLinkCursor, gVisited, gLinkInfo, gVisitedLinkColor, gNextLink, gLinkHiColor, gLoSprite, gHiSprite, gFreshLinkColor
-
- on initPseudoHTML
- set gLinkCursor to [201, 202]
- set gVisited to []
- set the itemDelimiter to ","
- set gLinkInfo to [#destination: EMPTY, #defaultColor: 0, #visited: 0]
- set gVisitedLinkColor to 177
- set gLinkHiColor to 250
- end
-
- on mouseDown
- set gNextLink to isLink()
- if not gNextLink then
- pass()
- else
- colorLinkText(gLinkHiColor)
- end if
- end
-
- on mouseUp
- if gNextLink then
- goToLink(gLinkInfo)
- end if
- pass()
- end
-
- on idle
- checkRollN(gLoSprite, gHiSprite)
- set linkHandle to isLink()
- if not linkHandle then
- cursor(-1)
- else
- cursor(gLinkCursor)
- end if
- end
-
- on isLink
- global oldCast, oldChar, lastLink, linkVal
- if the mouseCast > 0 then
- set mCast to the mouseCast
- set mChar to the mouseChar
- if the mouseChar < 0 then
- set linkVal to 0
- else
- set cCast to getCurrLabel() & "Links"
- if the number of member cCast <> -1 then
- if (mCast <> oldCast) or (oldChar <> mChar) then
- repeat with x = 1 to the number of lines in field cCast
- if integer(item 1 of line x of field cCast) = mCast then
- if not (mChar < integer(item 2 of line x of field cCast)) and not (mChar > integer(item 3 of line x of field cCast)) then
- set gLinkInfo to linkInfo(line x of field cCast)
- set linkVal to 1
- set oldCast to mCast
- set oldChar to mChar
- return linkVal
- exit
- end if
- end if
- end repeat
- set linkVal to 0
- set oldCast to mCast
- set oldChar to mChar
- return linkVal
- exit
- else
- return linkVal
- exit
- end if
- else
- set linkVal to 0
- end if
- end if
- else
- set linkVal to 0
- end if
- set oldCast to 0
- set oldChar to 0
- return linkVal
- end
-
- on goToLink theLink
- colorLinkText(gVisitedLinkColor)
- set linkDest to getaProp(gLinkInfo, #destination)
- if linkDest contains ".htm" then
- go(1, linkDest)
- else
- if linkDest contains ".dcr" then
- GoToNetMovie(linkDest)
- else
- go(linkDest)
- end if
- end if
- end
-
- on makeLink destination
- if the selection = 0 then
- put "You must hilite some text"
- exit
- end if
- if the number of member (getCurrLabel() & "Links") = -1 then
- makeLinkContainer(getCurrLabel())
- end if
- repeat with i = 1 to 48
- if the castNum of sprite i then
- if the castType of cast the castNum of sprite i = #text then
- set linkStart to offset(the selection, the text of field the castNum of sprite i)
- if linkStart then
- set linkCast to the castNum of sprite i
- exit repeat
- end if
- end if
- end if
- end repeat
- set unColor to the foreColor of char linkStart of member linkCast
- set visited to "0"
- set linkLine to linkCast & "," & linkStart & "," & the selEnd & "," & destination & "," & unColor & "," & visited & "," & string(0)
- saveLinkProps(getCurrLabel(), linkLine)
- end
-
- on refreshLinks clearing
- set cCast to getCurrLabel() & "Links"
- if the number of member cCast <> -1 then
- repeat with x = 1 to the number of lines in field cCast
- set linkStuff to linkInfo(line x of field cCast)
- if listp(linkStuff) then
- if clearing = 1 then
- setaProp(linkStuff, #visited, 0)
- put "0" into item 6 of line x of field cCast
- end if
- if getaProp(linkStuff, #visited) = 1 then
- set linkColor to gVisitedLinkColor
- else
- set linkColor to getaProp(linkStuff, #defaultColor)
- end if
- set the foreColor of char getaProp(linkStuff, #headChar) to getaProp(linkStuff, #tailChar) of member getaProp(linkStuff, #linkCast) to linkColor
- end if
- end repeat
- updateStage()
- end if
- end
-
- on colorLinkText theColor, theLink
- if not theLink then
- set theLink to gLinkInfo
- end if
- set the foreColor of char getaProp(theLink, #headChar) to getaProp(theLink, #tailChar) of member getaProp(theLink, #linkCast) to theColor
- updateStage()
- end
-
- on linkInfo theLine
- set oldDelim to the itemDelimiter
- set the itemDelimiter to ","
- if the number of items in theLine < 6 then
- set rVal to -1
- else
- set lCast to integer(item 1 of theLine)
- set tStart to integer(item 2 of theLine)
- set tEnd to integer(item 3 of theLine)
- set dest to item 4 of theLine
- set defColor to integer(item 5 of theLine)
- set visitBool to integer(item 6 of theLine)
- if not integerp(lCast) or not integerp(tStart) or not integerp(tEnd) or not stringp(dest) or not integerp(defColor) or not integerp(visitBool) then
- set rVal to -1
- end if
- end if
- if not rVal then
- set rVal to [#linkCast: lCast, #headChar: tStart, #tailChar: tEnd, #destination: dest, #defaultColor: defColor, #visited: visitBool]
- else
- set rVal to 0
- end if
- return rVal
- set the itemDelimiter to oldDelim
- end
-
- on saveLinkProps linkLabel, linkData
- set oldDelim to the itemDelimiter
- set the itemDelimiter to ","
- set linkCast to linkLabel & "Links"
- if the number of member linkCast = -1 then
- makeLinkContainer(linkLabel)
- end if
- if listp(linkData) then
- else
- if stringp(linkData) then
- set thisIndex to integer(the last item in linkData)
- end if
- end if
- set newIndex to numLinks(linkLabel) + 1
- if not thisIndex then
- delete item 6 of linkData
- put "," & string(newIndex) after linkData
- put linkData & RETURN after field linkCast
- else
- put linkData into line newIndex of field linkCast
- end if
- set the itemDelimiter to oldDelim
- end
-
- on numLinks theLabel
- set oldDelim to the itemDelimiter
- set the itemDelimiter to ","
- set theCast to theLabel & "Links"
- set rVal to 0
- if the number of member theCast <> -1 then
- repeat with i = 1 to the number of lines in field theCast
- if integer(the last item in line i of field theCast) > rVal then
- set rVal to integer(the last item in line i of field theCast)
- end if
- end repeat
- end if
- return rVal
- set the itemDelimiter to oldDelim
- end
-
- on linkLine theLabel, theIndex
- set oldDelim to the itemDelimiter
- set the itemDelimiter to ","
- set theCast to theLabel & "Links"
- set rVal to 0
- if the number of member theCast <> -1 then
- repeat with i = 1 to the number of lines in field theCast
- if integer(the last item in line i of field theCast) = theIndex then
- set rVal to i
- exit repeat
- end if
- end repeat
- end if
- return rVal
- set the itemDelimiter to oldDelim
- end
-
- on makeLinkContainer theLabel
- repeat with k = the number of member "startLinks" to the number of castMembers
- if (the name of cast k = 0) and (the castType of cast k = #text) then
- set the name of cast k to theLabel & "Links"
- end if
- end repeat
- end
-